package com.sccba.web.controller.yjcz;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.sccba.common.annotation.Log;
import com.sccba.common.core.controller.BaseController;
import com.sccba.common.core.domain.AjaxResult;
import com.sccba.common.core.page.TableDataInfo;
import com.sccba.common.enums.BusinessType;
import com.sccba.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sccba.emtbusiness.domain.YjczHandleTimeLine;
import com.sccba.emtbusiness.service.IYjczHandleTimeLineService;

/**
 * 处理时间线记录Controller
 * 
 * @author lichh
 * @date 2024-04-24
 */
@RestController
@RequestMapping("/yjcz/handleTimeLine")
public class YjczHandleTimeLineController extends BaseController
{
    @Autowired
    private IYjczHandleTimeLineService yjczHandleTimeLineService;

    /**
     * 查询处理时间线记录列表
     */
    @PreAuthorize("@ss.hasPermi('yjcz:handleTimeLine:list')")
    @GetMapping("/list")
    public TableDataInfo list(YjczHandleTimeLine yjczHandleTimeLine)
    {
        startPage();
        List<YjczHandleTimeLine> list = yjczHandleTimeLineService.selectYjczHandleTimeLineList(yjczHandleTimeLine);
        return getDataTable(list);
    }

    /**
     * 导出处理时间线记录列表
     */
    @PreAuthorize("@ss.hasPermi('yjcz:handleTimeLine:export')")
    @Log(title = "处理时间线记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YjczHandleTimeLine yjczHandleTimeLine)
    {
        List<YjczHandleTimeLine> list = yjczHandleTimeLineService.selectYjczHandleTimeLineList(yjczHandleTimeLine);
        ExcelUtil<YjczHandleTimeLine> util = new ExcelUtil<YjczHandleTimeLine>(YjczHandleTimeLine.class);
        util.exportExcel(response, list, "处理时间线记录数据");
    }

    /**
     * 获取处理时间线记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('yjcz:handleTimeLine:query')")
    @GetMapping(value = "/{pkId}")
    public AjaxResult getInfo(@PathVariable("pkId") Long pkId)
    {
        return success(yjczHandleTimeLineService.selectYjczHandleTimeLineByPkId(pkId));
    }

    /**
     * 新增处理时间线记录
     */
    @PreAuthorize("@ss.hasPermi('yjcz:handleTimeLine:add')")
    @Log(title = "处理时间线记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YjczHandleTimeLine yjczHandleTimeLine)
    {
        return toAjax(yjczHandleTimeLineService.insertYjczHandleTimeLine(yjczHandleTimeLine));
    }

    /**
     * 修改处理时间线记录
     */
    @PreAuthorize("@ss.hasPermi('yjcz:handleTimeLine:edit')")
    @Log(title = "处理时间线记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YjczHandleTimeLine yjczHandleTimeLine)
    {
        return toAjax(yjczHandleTimeLineService.updateYjczHandleTimeLine(yjczHandleTimeLine));
    }

    /**
     * 删除处理时间线记录
     */
    @PreAuthorize("@ss.hasPermi('yjcz:handleTimeLine:remove')")
    @Log(title = "处理时间线记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pkIds}")
    public AjaxResult remove(@PathVariable Long[] pkIds)
    {
        return toAjax(yjczHandleTimeLineService.deleteYjczHandleTimeLineByPkIds(pkIds));
    }
}
